package com.naja.cdc.develop;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.ApplicationPidFileWriter;

import java.io.Closeable;
import java.io.IOException;

/**
 * 程序入口
 */
@SpringBootApplication
@Slf4j
public class MainApplication  implements ApplicationRunner, Closeable {

    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(MainApplication.class);
        springApplication.setWebApplicationType(WebApplicationType.NONE);
        springApplication.addListeners(new ApplicationPidFileWriter("pid"));
        springApplication.run(args);
    }
    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("o=|>> 服务全部启动完成 <<|=o");
    }
    @Override
    public void close() throws IOException {
        log.info("o=|>> 服务停止 <<|=o");
    }
}
